package com.cheers.action;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.apache.struts2.ServletActionContext;

import com.cheers.common.ResultModel;
import com.opensymphony.xwork2.ActionSupport;

public class BaseAction extends ActionSupport {

	private static final long serialVersionUID = 1312373093895758940L;
	
	protected static final Logger logger = Logger.getLogger(BaseAction.class);
	
	public ResultModel result;

	
	public boolean isPost(String request) {
		String method = findRequest().getMethod();
		if (!"post".equals(method.toLowerCase())) {
			logger.warn(request+" no post");
			return false;
		}
		return true;
	}
	
	public ResultModel getResult() {
		return result;
	}
	public void setResult(ResultModel result) {
		this.result = result;
	}
	
	
	private HttpServletRequest findRequest() {
		return ServletActionContext.getRequest();
	}
	
}
